-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
THREESCALE-11498: API plans features #3949
base: master
Are you sure you want to change the base?
Conversation
previous name was hard to understand, and incorrect, since features may belong to service or account plans
1c4bdef
to
a5d6b40
Compare
"post": { | ||
"summary": "Account Plan Features Create", | ||
"description": "Associate an account feature to an account plan.", | ||
"summary": "Account Plan Features Enable", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"summary": "Account Plan Features Enable", | |
"summary": "Account Plan Feature Enable", |
Maybe this to clarify further that it is for a single feature.
"delete": { | ||
"summary": "Account Plan Features Delete", | ||
"description": "Deletes the association of an account feature to an account plan.", | ||
"summary": "Account Plan Features Disable", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"summary": "Account Plan Features Disable", | |
"summary": "Account Plan Feature Disable", |
I believe this is not accurate. There is actually a set of endpoints under "Service Features" section that allows managing application plans features (creating new ones, updating, deleting etc.) I'm not sure about features for service and account plans though... |
@mayorova I applied your suggestions 6afe150
So, service features are created and enabled by:
Account features are created and enabled by:
Application features can only be created from UI and enabled by: I love porta consistency. |
has_many :features, :through => :features_plans do | ||
# returns all features owned by issuer, not only enabled by plan | ||
def of_service | ||
has_many :features_plans, as: :plan, dependent: :delete_all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you add dependent: :delete_all
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember, but it was a good reason, for sure!
It makes sense, though. features_plans
is a N-N table between features
and plans
, and every record represents a feature enabled for a plan. It makes no sense to keep a feature enabled for a plan after the plan is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how many of them can there be? We split deleting for transactions failing reason when they are too big. That's why we have the background deletion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan having more features has 88. I don't think that's usual though, probably most of them have less than 10. Also, the association between features
and features_plans
is marked as dependent: :delete_all
as well:
Line 17 in 908be5d
has_many :features_plans, :dependent => :delete_all |
Not exactly 😅
It's endpoints for Service plans features CRUD that are missing, and can only be done via UI. |
Ah, I was so wrong, so the application features are created through the services endpoint, and there's no endpoint for services. Nice, much better! 😅 |
What this PR does / why we need it:
The plan features API is a bit messy. For instance, AFAIK there's no endpoints to create or remove features for a plan, they must be created and deleted from the UI. The API only allows enabling or disabling features previously created from the UI. These are the endpoints:
feature_id
as query param or form dataI find this inconsistent and confusing. I guess we need to keep it as it is to avoid breaking changes, but it'd be good if we create a new API for this, at some point... in the future...
In this PR I'm making a few changes:
POST /admin/api/account_plans/:account_plan_id/features/:id(.:format)
I modified to be
POST /admin/api/account_plans/:account_plan_id/features
which exists and it's the correct one to enable features. d1b1d00Which issue(s) this PR fixes
https://issues.redhat.com/browse/THREESCALE-11498